import i18n from '@/locales/i18n';
import React from 'react'
import { useTranslation } from 'react-i18next';

export default function LocaleCom() {
  //调用 useTranslation 
  let {t} = useTranslation();
  return (
    <div>
      <h2>
        {t('title')}
      </h2>
      <button onClick={() => {
        i18n.changeLanguage('zh')
      }}>中文</button>
      <button onClick={() => {
        i18n.changeLanguage('en')
      }}>英文</button>
    </div>
  )
}
